#ifndef IDEAOPTICSSPECTROMETER_H
#define IDEAOPTICSSPECTROMETER_H

#include <QMutex>
#include <QByteArray>
#include "BaseSpectroMeter.h"
#include "MultiChannelSpectrometerWrapper.h"

class IdeaopticsSpectroMeter:public BaseSpectroMeter
{
public:
    IdeaopticsSpectroMeter();
    ~IdeaopticsSpectroMeter();
    // BaseDevice interface
public:
    void SetOtherConfig(QJsonObject config) override;

    // BaseSpectroMeter interface
public:
    bool InitComm();
    static bool EnumSpectro(QList<AvsInfo> &listAvsInfo);
    bool OpenSpectro() override;
    bool CloseSpectro() override;
    bool SetMeasureParam(AvsMeasPara param) override;
    bool GetMeasParam(AvsMeasPara &param) override;
    const QList<double> GetLambda() override;
    bool StartMeasure() override;
    bool Stop() override;
    bool SoftTrigger() override;//执行软件触发

    SpectroInfoTag GetSpectrumInfo() override;

    static void OnPushedSpectrumOfOneChannelReceived(Ideaoptics::IMultiChannelSpectrometer* dev, char* sn, Ideaoptics::SpectrumDataClr* data, void* userData);

public slots:
    void ReceiveDataIsHere(Ideaoptics::SpectrumDataClr* data);

protected:
    QString _pcIP;
    QString _spectrometerIP;
    int _pcPort;
    int _spectrometerPort;

private:
    QList<double> _lambda;
    AvsMeasPara _measParam;
    static QMutex  _mutex;   //可以是私有成员变量，也可以是全局变量

    Ideaoptics::IMultiChannelSpectrometer* m_dev;
    const char* _sn = NULL;
    QByteArray _byteArray;

    static int m_chNum; //设备数
    static Ideaoptics::ChannelStatus* m_chStatus;
};

#endif // IDEAOPTICSSPECTROMETER_H
